//
//  CLNetWorkConfig.h
//  Charles
//
//  Created by Charles on 2018/6/6.
//  Copyright © 2018年 charles. All rights reserved.
//

#import <Foundation/Foundation.h>

@class CLBaseRequest,AFSecurityPolicy;

@protocol CLUrlFilterProtocol <NSObject>

- (NSString *)filterUrl:(NSString *)originUrl withRequest:(CLBaseRequest *)request;

@end

@protocol CLCacheDirPathFilterProtocol <NSObject>

- (NSString *)filterCacheDirPath:(NSString *)originPath withRequest:(CLBaseRequest *)request;

@end

@interface CLNetWorkConfig : NSObject
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;

// 配置类单例
+ (CLNetWorkConfig *)sharedConfig;

// 请求基础地址
@property (nonatomic, strong) NSString *baseUrl;

@property (nonatomic, strong, readonly) NSArray<id<CLUrlFilterProtocol>> *urlFilters;
@property (nonatomic, strong, readonly) NSArray<id<CLCacheDirPathFilterProtocol>> *cacheDirPathFilters;
// 安全策略
@property (nonatomic, strong) AFSecurityPolicy *securityPolicy;
@property (nonatomic) BOOL debugLogEnabled;
// 初始化AFHTTPSessionManager 使用 默认nil
@property (nonatomic, strong) NSURLSessionConfiguration *sessionConfiguration;

- (void)addUrlFilter:(id<CLUrlFilterProtocol>)filter;
- (void)clearUrlFilter;

- (void)addCacheDirPathFilter:(id<CLCacheDirPathFilterProtocol>)filter;
- (void)clearCacheDirPathFilter;

@end
